package com.tledu.spring.service.impl;

import com.tledu.spring.dao.MaterialInfoMapper;
import com.tledu.spring.domain.MaterialInfo;
import com.tledu.spring.service.IMaterialInfoService;
import lombok.AllArgsConstructor;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @Author: rupert-tears
 * @Date: Created in 10:34 2021/7/3
 * @Description: 优秀的人都在孤独的翻山越岭！
 */
@Service
@AllArgsConstructor
public class MaterialInfoServiceImpl implements IMaterialInfoService {

    private MaterialInfoMapper materialInfoMapper;

    @Override
    public List<MaterialInfo> list() {
        return materialInfoMapper.list();
    }

    @Override
    public Integer insert(MaterialInfo materialInfo) {
        return materialInfoMapper.insert(materialInfo);
    }

    @Override
    public Integer delete(Integer id) {
        return materialInfoMapper.delete(id);
    }

    @Override
    public List<MaterialInfo> query(String num) {
        if ("".equals(num)){
            return materialInfoMapper.list();
        }else {
            return materialInfoMapper.query(num);
        }
    }

    @Override
    public Integer update(MaterialInfo materialInfo) {
        return materialInfoMapper.update(materialInfo);
    }

    @Override
    public MaterialInfo selectById(Integer id) {
        return materialInfoMapper.selectById(id);
    }
}
